package main

import (
	"github.com/gin-gonic/gin"
)

type IPathRouter interface {
	path() string

	get() string
	post() string
	put() string
	delete() string
}

type IRouter interface {
	IPathRouter

	Find(c *gin.Context)
	Create(c *gin.Context)
	Update(c *gin.Context)
	Delete(c *gin.Context)
}

func RegisterRouter(router *gin.Engine, rs ...IRouter) {
	for _, r := range rs {
		router.GET(r.get(), r.Find)
		router.POST(r.post(), r.Create)
		router.PUT(r.put(), r.Update)
		router.DELETE(r.delete(), r.Delete)
	}
}
